<!-- 交易记录 -->
<template>
	<view class="home">
		<view class="header">
			<text class="header_time">时间</text>
			<text class="header_type">交易类型</text>
			<text class="header_num">交易金额</text>
		</view>
		<block v-if="list.length > 0">
			<view class="header" v-for="(item,index) in list" :key="index">
				<text class="header_time">{{item.transfertime | formatDate}}</text>
				<text class="header_type">微信</text>
				<text class="header_num">{{item.money}}</text>
			</view>
		</block>
		<view class="view" v-else>暂时没有任何数据哦~</view>
	</view>
</template>

<script>
	import {withdrawListAPI} from '@/api/user'
	export default {
		data() {
			return {
				list:[]
			}
		},
		mounted() {
			
		},
		onShow() {
			this.getData()
		},
		methods:{
			getData(){
				uni.showLoading({
					title:'加载中'
				})
				var parmes = {
					token:uni.getStorageSync('accessToken')
				}
				withdrawListAPI(parmes).then(res => {
					if(res.code == 1){
						this.list = res.data
					}else{
						uni.showToast({
							icon:'none',
							title:res.msg
						})
					}
					uni.hideLoading()
				})
			},
			
		},
		//时间戳处理
		filters: {
			formatDate: function(value) {
				var date = new Date();
				//date.setTime(value);
				var month = date.getMonth() + 1;
				if (month < 10)
					month = "0" + month;
				var time = date.getFullYear() + "-" + month + "-" + date.getDate();
				return time;
			}
 
		},
		
	}
</script>

<style scoped lang="scss">
	.home{
		overflow: hidden;
	}
	.header{
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100rpx;
		padding: 0 30rpx;
		border-bottom: 2rpx solid #eee;
		.header_time{
			font-size: 28rpx;
			color: #303133;
			width: 40%;
			text-align: center;
		}
		.header_type{
			font-size: 28rpx;
			color: #303133;
			width: 30%;
			text-align: center;
		}
		.header_num{
			font-size: 28rpx;
			color: #303133;
			width: 30%;
			text-align: center;
		}
	}
	.view{
		min-height: 100vw;
		font-size: 26rpx;
		color: #909193;
		letter-spacing: 1rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}
</style>